import request from '@/utils/request'

// 获取用户列表
export const getUserList = (data) => { 
  return request({
    url: '/api/user/Xy_ks_user',
    method: 'GET',
    data
  })
}

// 获取所有用户列表
export const UserListAll = (organizeId) => {
  return request({
    url: `/api/user/Xy_ks_user/All?organizeId=${organizeId}`,
    method: 'GET'
  })
}

// 获取用户下拉框列表(公司+部门+用户)
export const getUserSelector = (organizeId) => {
  return request({
    url: `/api/user/Xy_ks_user/Selector?organizeId=${organizeId}`,
    method: 'GET'
  })
}

// 新建用户
export const createUser = (data) => {
  return request({
    url: '/api/user/Xy_ks_user',
    method: 'POST',
    data
  })
}

// 修改用户
export const updateUser = (data) => {
  return request({
    url: `/api/user/Xy_ks_user/${data.id}`,
    method: 'PUT',
    data
  })
}

// 获取用户信息
export const getUserInfo = (id,organizeId) => {
  return request({
    url: `/api/user/Xy_ks_user/${id}?organizeId=${organizeId}`,
    method: 'GET'
  })
}

// 删除用户
export const delUser = (id,organizeId) => {
  return request({
    url: `/api/user/Xy_ks_user/${id}?organizeId=${organizeId}`,
    method: 'DELETE'
  })
}

// 修改用户密码
export const resetUserPassword = (data) => {
  return request({
    url: `/api/permission/Users/${data.id}/Actions/ResetPassword`,
    method: 'POST',
    data
  })
}

// 更新用户状态
export const updateUserState = (id,organizeId) => {
  return request({
    url: `/api/permission/Users/${id}/Actions/State?organizeId=${organizeId}`,
    method: 'PUT'
  })
}

// IM通讯获取用户
export const getImUser = data => {
  return request({
    url: '/api/permission/Users/ImUser',
    method: 'GET',
    data
  })
}

// 获取用户下拉框列表
export const getImUserSelector = (organizeId, keyword) => {
  return request({
    url: `/api/permission/Users/ImUser/Selector/${organizeId}`,
    method: 'post',
    data: { keyword }
  })
}

// 获取用户基本信息
export const getUserInfoList = (userId,organizeId) => {
  return request({
    url: '/api/permission/Users/getUserList',
    method: 'post',
    data: { userId ,organizeId}
  })
}